package edu.friday.controller;

import edu.friday.Service.SysRoleService;
import edu.friday.common.base.BaseController;
import edu.friday.model.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController {
    //如果需要在Controller去调用数据库，最好加一个Service中间层
    //而不是直接注入repository，虽然那样也可以
    //一般的结构，controller->service->repository

    @Autowired
    private SysRoleService sysRoleService;

    @GetMapping("/list")
    public List<SysRole> list() {
        return sysRoleService.selectRoleList();
    }

}
